package com.icen.utils.comm;

import android.os.Handler;
import android.os.Message;

/**
 * Message Utils Class
 * 
 * @author IcenHan
 * 
 */
public class MessageUtils {
	public static final int MSG_FAIL = 1;
	public static final int MSG_ERROR = 2;
	public static final int MSG_SUCCESS = 3;

	public static final int MSG_INIT = 4;
	public static final int MSG_LOAD = 5;
	public static final int MSG_START = 6;
	public static final int MSG_PAUSE = 7;
	public static final int MSG_STOP = 8;
	public static final int MSG_FINISH = 9;
	public static final int MSG_DESTORY = 10;

	public static final int MSG_UP = 11;
	public static final int MSG_DOWN = 12;
	public static final int MSG_LEFT = 13;
	public static final int MSG_RIGHT = 14;

	/**
	 * 发送Handler异步消息
	 * 
	 * @param handler
	 * @param what
	 */
	public static void sendMessage(Handler handler, int what) {
		MessageUtils.sendMessage(handler, what, null);
	}

	/**
	 * 发送Handler异步消息
	 * 
	 * @param handler
	 * @param what
	 * @param obj
	 */
	public static void sendMessage(Handler handler, int what, Object obj) {
		Message msg = new Message();
		msg.what = what;
		if (obj != null) {
			msg.obj = obj;
		}
		msg.setTarget(handler);
		handler.sendMessage(msg);
	}

}
